# -*- coding: utf-8 -*-
import re
from common import get_from_yd
from common import sql_script


def get_fce():
    p1 = re.compile(r'^[\w-]+$')
    f = open("fce.txt")
    ket = {}
    for line in f:
        en = ''
        zh = ''
        oneline = line.split()
        for i in oneline:
            if p1.match(i):
                if i == "adv" or i == "adj" or i == "v":
                    print i
                elif en:
                    en = en + " " + i
                else:
                    en = i
            else:
                if zh:
                    zh = zh + "," + i
                else:
                    zh = i
        ket[en] = zh
        print en, zh
    return ket


def main():
    ket = get_fce()
    #for i in ket:
    #    get_from_yd.get_audio(i, "/Users/stack/python/python3721/ket")
    #sql_script.insert_list(ket.items(), "112.126.90.160", 56, "剑桥FCE", 4724)
    print len(ket)


if __name__ == '__main__':
    main()
